package dfl.bysj.entity.VO;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.sun.org.apache.xpath.internal.operations.Bool;
import dfl.bysj.entity.Seat;
import dfl.bysj.entity.StudentSeatRelation;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @Author: DFL
 * @Data: 2022/5/616:20
 */
@Data
public class ReserveSUCCVO implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.AUTO)
    private Integer stuSeaId;

    private Integer stuUserId;

    private Integer seaStaId;

    private Boolean signState;

    private Boolean singBackState;

    private String resStartTime;

    private String resEndTime;

    private Boolean overTimeCheck;

   public static ReserveSUCCVO getReserveSUCCVO(StudentSeatRelation studentSeatRelation){
       ReserveSUCCVO reserveSUCCVO=new ReserveSUCCVO();
       reserveSUCCVO.setSeaStaId(studentSeatRelation.getSeaStaId());
       reserveSUCCVO.setStuUserId(studentSeatRelation.getStuUseId());
       reserveSUCCVO.setSignState(studentSeatRelation.getSignState());
       reserveSUCCVO.setSingBackState(studentSeatRelation.getSingBackState());
       reserveSUCCVO.setStuSeaId(studentSeatRelation.getStuSeaId());

       DateTimeFormatter dateTimeFormatter= DateTimeFormatter.ofPattern("yyyy年MM月dd日 HH:mm");

       LocalDateTime start=studentSeatRelation.getResStartTime();
       LocalDateTime end=studentSeatRelation.getResEndTime();

       reserveSUCCVO.setResStartTime(start.format(dateTimeFormatter));
       reserveSUCCVO.setResEndTime(end.format(dateTimeFormatter));

       reserveSUCCVO.setOverTimeCheck(studentSeatRelation.getOvertimeCheck());

       return reserveSUCCVO;
   }
}
